<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>login</title>

    <script type="text/javascript" src="static/js/jquery.min.js"></script>
    <script type="text/javascript"
            src="static/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap-treeview.min.css"
    >
    <script src="static/js/bootstrap/js/bootstrap-treeview.min.js"></script>
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap.addtabs.css">
    <script src="static/js/bootstrap/js/bootstrap.addtabs.min.js"></script>
    <link rel="stylesheet" href="static//js/bootstrap/css/bootstrap-table.min.css">
    <script src="static/js/bootstrap/js/bootstrap-table.min.js"></script>
    <script src="static/js/bootstrap/js/bootstrap-table-zh-CN.min.js"></script>
    <script src="static/js/bootstrap/js/bootbox.js"></script>
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap-datetimepicker.min.css" />
    <script type="text/javascript"
            src="static/js/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript"
            src="static/js/bootstrap/js/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="static/js/bootstrap-fileinput/js/fileinput.js"></script>
    <script src="static/js/bootstrap-fileinput/js/locales/zh.js"></script>
    <link rel="stylesheet" href="static/js/bootstrap-fileinput/css/fileinput.css">


    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html {
            height: 100%;
            width: 100%;
            overflow: hidden;
            margin: 0;
            padding: 0;
            background-repeat: no-repeat;
            background-size: 100% 100%;
            -moz-background-size: 100% 100%;
        }

        body {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
            background: url(static/js/login.jpg) no-repeat center;
            background-size: 100%;
        }

        #loginDiv {
            width: 37%;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 300px;

            box-shadow: 7px 7px 17px rgba(52, 56, 66, 0.5);
            border-radius: 5px;
        }

        #name_trip {
            margin-left: 50px;
            color: #ff0000;
        }

        p {
            margin-top: 30px;
            margin-left: 20px;
            color: azure;
        }

        input {
            margin-left: 15px;
            border-radius: 5px;
            border-style: hidden;
            height: 30px;
            width: 140px;

            outline: none;
            color: black;
            padding-left: 10px;
        }

        .button {
            border-color: cornsilk;

            color: black;
            border-style: hidden;
            border-radius: 10px;
            width: 100px;
            height: 31px;
            font-size: 16px;
            text-indent: 0px;
            /*letter-spacing: 0.5px;*/
        }
    </style>
</head>

<body >
<div id="loginDiv">
    <form id="myForm">
        <h1 style="text-align: center;color: aliceblue;">LOGIN  IN</h1>
        <p>User Name:<input id="userAccout" name="userAccout" type="text"><label id="name_trip"></label></p>

        <p> Password：<input id="userPassword" name="userPassword" type="password"><label id="password_trip"></label></p>

        <div style="text-align: center;margin-top: 30px;">
            <input type="button" onclick="login()" class="button" value="login up">
            <input type="reset" class="button" value="register" onclick="toRegister()">
        </div>
    </form>
</div>

</body>
<script>
    function login(){
        $.ajax({
            url:"login",
            type:"post",
            dataType:"json",
            data:$("#myForm").serialize(),
            success:function(data){
                if(data.code==200){
                        location.href="/toLayout";
                }else if(data.code==201){
                    alert("账号或密码错误");
                }else{
                    alert("系统错误");
                }
            }
        })
    }

    function toRegister(){
        location.href = "register.html"
    }





</script>


</html>